﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HR_Business;

namespace HR_Web.Employees
{
    public partial class Form : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                LoadData();
            }
        }

        private void LoadData()
        {
            if (!string.IsNullOrEmpty(Request.QueryString["Id"]))
            {
                int id = int.Parse(Request.QueryString["Id"]);
                PopulateControls(id);
            }

        }

        private void PopulateControls(int id)
        {
            formViewEmployee.DataSource = new List<Employee>() { new Employee().GetEmployeeByEmployeeId(id) };
            formViewEmployee.DataBind();
        }

        protected void ButtonSave_Click(object sender, EventArgs e)
        {
            //Employee employee = new Employee();
            //employee.FirstName = txtFirstName.Text.Trim();
            //employee.LastName = txtLastName.Text.Trim();

            //Employee employee = Employee.CreateEmployee(-1, txtFirstName.Text.Trim(),
            //    txtLastName.Text.Trim(), txtOfficeId.Text.Trim(),
            //   DateTime.Parse(txtDateOfJoin.Text.Trim()),
            //   DateTime.Parse(txtDateOfConfirmation.Text.Trim()),
            //   true, DateTime.MinValue, uclCompany.SelectedItemId, uclDepartment.SelectedItemId,
            //   uclDesignation.SelectedItemId, uclEmploymentType.SelectedItemId);




        }

        protected void ButtonGoToListPage_Click(object sender, EventArgs e)
        {

        }

    }
}